<template>
    <div>
        <card _Title="平台反馈" />
        <div class="add-box">
            <Form ref="PlatformFeedback" :model="PlatformFeedbackModel" :label-width="100">
                <FormItem label="图片上传">
                    <FileUpload @input="FileUploadInput" :fileType="['png', 'jpg', 'jpeg']"
                        :value="PlatformFeedbackModel.image">
                    </FileUpload>
                </FormItem>
                <FormItem label="反馈内容">
                    <Input v-model="PlatformFeedbackModel.content" type="textarea"
                        :autosize="{ minRows: 2, maxRows: 5 }" placeholder="请输入反馈内容"></Input>
                </FormItem>
            </Form>
        </div>
        <div class="mt_20">
            <Button type="primary" class="mr_10" :loading="loading" @click="PlatformFeedbackFun">确定</Button>
            <Button @click="$router.back()">返回</Button>
        </div>

        <!-- <multipleMap  ref="map" @callback="getAddress" /> -->
    </div>
</template>

<script>
import card from "@/components/card";
import {
    saveFeedback
} from "@/api/writer/index.js";
export default {
    name: "PlatformFeedback",
    data() {
        return {
            PlatformFeedbackModel: {
                image: null,
                content: "",
            },
            ruleInline: {
                // 验证规则
                name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
                address: [{ required: true, message: "请输入地址", trigger: "change" }],
                detail: [
                    { required: true, message: "请输入详细地址", trigger: "blur" },
                ],
                mobile: [
                    { required: true, message: "请输入手机号码" },
                    {
                        pattern: RegExp.mobile,
                        trigger: "blur",
                        message: "请输入正确的手机号",
                    },
                ],
            },
            loading: false, // 加载状态
            mapMsg: {}, // 地图信息
        };
    },
    methods: {
        PlatformFeedbackFun() {
            // 平台反馈
            // this.$refs.PlatformFeedback.validate((valid) => {
            //   if (valid) {
            //     this.$Modal.confirm({
            //       title: "提示",
            //       content: "<p>反馈成功</p>",
            //       okText: "确定", 
            //     }) 
            //   }  
            // }) 
            saveFeedback(this.PlatformFeedbackModel).then((res) => {
                if (res.code === 200) {
                    this.$Message.success('反馈成功!');
                }
            })
        },
        FileUploadInput(val) {
            this.PlatformFeedbackModel.image = val;
        },
    },
    mounted() {
        const id = this.$route.query.id;
        if (id) this.getAddrById(id);
    },
    components: {
        card,
    },
};
</script>

<style scoped lang="scss">
.add-box {
    margin: 40px 0;
}
</style>